import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    count: 0
  },
  mutations: {
	add1(state){
		state.count++
	},
	sub1(state){
		state.count--
	},
	subN(state,N){
		state.count -= N;
	}
  },
  actions:{
	addAsync(context){
		setTimeout(function(){
			context.commit('add1')
		},1000)
	} 
  }
})


export default store;